package cn.clq.ymcc.feign;

import cn.clq.ymcc.constants.GlobalErrorEnum;
import cn.clq.ymcc.domain.Login;
import cn.clq.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author clqlongbao
 * @version 1.0
 * @description: TODO
 * @date 2022/7/19 15:47
 */
@Component
public class LoginFeignClientFallBackFactory implements FallbackFactory<LoginFeignClient> {

    @Override
    public LoginFeignClient create(Throwable throwable) {
        return new LoginFeignClient() {

            @Override
            public JSONResult save(Login login) {
                throwable.printStackTrace();
                return JSONResult.error(GlobalErrorEnum.SERVICE_REFUSE.getMessage());//服务暂时无法使用
            }

            @Override
            public JSONResult list() {
                throwable.printStackTrace();
                return JSONResult.error(GlobalErrorEnum.SERVICE_REFUSE.getMessage());//服务暂时无法使用;
            }
        };
    }
}
